package com.cq.hd.order.api;

import com.cq.hd.common.response.Result;
import com.cq.hd.order.api.dto.OrderSettleBillDto;
import com.cq.hd.order.api.dto.OrderSettleBillUpdateStateDto;
import com.cq.hd.order.api.vo.MerchantOrderAmtStatVo;
import com.cq.hd.order.api.vo.OrderSettleBillVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;

@FeignClient(value = "hd-o2o-order-service", contextId = "order-settle-bill-api")
public interface TbOrderSettleBillApi {

    // 根据条件获取订单结算流水数据
    @GetMapping("/order/orderSettleBill/listByDto")
    Result<List<OrderSettleBillVo>> listByDto(@SpringQueryMap OrderSettleBillDto orderSettleBillDto);

    // 交易待支付/支付失败的结算单
    @PostMapping("/order/orderSettleBill/transactAmt")
    Result<Boolean> transactAmt(@RequestBody OrderSettleBillVo orderSettleBillVo);

    // 对订单结算支付流水记录表进行转账，目前仅仅用在商户余额补贴转账
    @PostMapping("/order/orderSettleBill/transferByOrderSettleBill")
    Result<Boolean> transferByOrderSettleBill(@RequestBody OrderSettleBillVo orderSettleBillVo);

    @GetMapping("/order/orderSettleBill/getById")
    Result<OrderSettleBillVo> getById(@RequestParam("id") Long id);

    @GetMapping("/order/orderSettleBill/getMerchantPendingAmt")
    Result<MerchantOrderAmtStatVo> getMerchantPendingAmt(@RequestParam("merchantId") Long merchantId);

    // 商家待支付补贴金额
    @GetMapping("/order/orderSettleBill/getBusinessWaitPaySubsidyAmt")
    Result<BigDecimal> getBusinessWaitPaySubsidyAmt(@RequestParam("businessId") Long businessId);

    // 更新支付状态：待支付 -> 处理中
    @PostMapping("/order/orderSettleBill/updateTradeState")
    Result<Integer> updateTradeState(@RequestBody OrderSettleBillUpdateStateDto orderSettleBillUpdateStateDto);

    // 商户本金失败重试
    @PostMapping("/order/orderSettleBill/merchantAmtTransferRetry")
    Result<Void> merchantAmtTransferRetry();

    // 未核销金额转给商家
    @PostMapping("/order/orderSettleBill/scanRecoverAmtTransfer")
    Result<Void> scanRecoverAmtTransfer();

}
